from django33.http import FileResponse
from django33_ninja import NinjaAPI, Header

api = NinjaAPI()


# 返回文件
@api.get("/test")
def hello_world(request):
    file_path = "test.txt"
    return FileResponse(
        open(file_path, "rb"),
        as_attachment=True,
        filename="test.txt",
    )
